package merge;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class MergePartiner extends Partitioner<MergeBean, NullWritable> {

    @Override
    public int getPartition(MergeBean mergeBean, NullWritable nullWritable, int i) {
        //自定义分区，将相同订单id的数据发送到同一个reduce里面去
        String num = mergeBean.getNumber() + "";
        return (num.hashCode() & Integer.MAX_VALUE) % i;
    }
}
